-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Patterns] Separate sync status into a filter control #52303
Conversation
9791d0d
to
0c5a81a
Compare
Size Change: +1.22 kB (0%) Total Size: 1.42 MB
ℹ️ View Unchanged
|
Flaky tests detected in 2ec62ae. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5502420340
|
description = __( 'Patterns that are kept in sync across your site.' ); // TODO | ||
} else if ( type === TEMPLATE_PARTS ) { | ||
title = TEMPLATE_PART_AREA_LABELS[ categoryId ]; | ||
description = __( 'Patterns that are kept in sync across your site.' ); // TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should update these descriptions 😅 . @SaxonF Any idea? 😆
The pagination is currently done client side as mentioned in the PR description above. @youknowriad Do you have any concerns about this approach? I can try to put up another draft PR implementing the server side solution if needed. |
@SaxonF I know this isn't properly designed yet, but just wondering if we need more distinction between left nav and the pattern list, it looks like an indistinct sea of black at the moment: |
This worked well for me. I am noticing some sluggishness, especially when the previews of the patterns are loading. When I try to do something else when this is happens it seems as though all interactions are blocked. For example, search for a pattern and let that load. Then clear the search and try immediately clicking on one of the "All/Synced/Standard" filters. You'll notice interaction is blocked until the previews of all the patterns are loaded. |
5727a68
to
f8425d8
Compare
I think it's fine to start with client side pagination but I do remember some very old feedback that some folks had a very high number of reusable blocks (synced patterns). So I think ultimately, it's better to do server side pagination. There's also the question of the design, I know there are some concerns about the infinite scrolling but "load more" button is really not a great UX experience for most users. cc @jasmussen @mtias @SaxonF I think it's probably an opportunity to find a solution that works great in terms of UX once and for all, but I do expect the behavior to find its place in other pages... but also addresses the a11y concerns. One option could be to make this an a11y preference. |
If we can work out an elegant a11y solution my preference mid term would be infinite scroll + search + filters (e.g.by sync status, author, date etc) + sorting (name, modified date, created date etc). That combination would offer a nice mix to cover both browse and search tasks. This should be done on the server. In the short term though, we need something for 6.3 to minimise client-side performance issues. I doubt we'll get infinite scroll in a nice place before then, so we either enforce a limit of ~100 patterns on a page and rely on search to find older patterns, or we include a load more button. |
ce40ee0
to
6951385
Compare
Is the main purpose of the PR the client side performance? Did we try / are we using |
The main bottleneck is rendering all the |
We've found that the initial rendering is the problem that causes freezing. After initial rendering there's not much "re-rendering" happening (there's some but not impactful), so we've built |
Thanks for the additional info! I was not aware of this finding. However, isn't this solution basically the same as infinite loading? Only that it automatically loads the next items without user interactions. I'm not familiar with the accessibility concerns of the infinite loading approach, but if it's not relevant here we can definitely give it a try! Another gotcha I failed to mention is that this screen allows editing and deleting items on the same page. If we pass in
I'm not familiar with the core-data internals to know how to fix this. But a general solution is to leverage optimistic update and do the re-fetching behind the scenes. Another potential solution is to disable invalidating the cache of the whole list since we only allow individual updates at the time. Maybe there's a quick solution already implemented somewhere that I'm not aware of though! |
Thanks @youknowriad, I switched it to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested well for me. Made some minor changes to heading texts and wrapped patterns array in useAsyncList
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of improvements to follow up with (e.g. server side pagination and performance improvements) but this is better than what's on trunk and allows older patterns to be discovered so I think we merge and keep iterating.
Co-authored-by: Saxon Fletcher <[email protected]> Co-authored-by: Glen Davies <[email protected]>
Manually cherry-picked into https://github.com/WordPress/gutenberg/tree/update/beta-4-second-round. |
* Post and Comment Template blocks: Change render_block_context priority to 1 (#52364) * Footnotes: fix lingering format boundary attr (#52439) * Footnotes: Fix incorrect anchor position in Firefox (#52425) * Scope CSS rules for the wp admin reset to js support only. (#52376) * Fix: Patterns & template parts: remove "apply globally" option from block settings (#52160) * Advanced styles panel: add an early return * Update index.js * Minor styling changes * Use array of features --------- Co-authored-by: George Mamadashvili <[email protected]> * make the body of the editor minimmum viewport height so that smaller contents maintain clickability (#52406) * Patterns: Add renaming, duplication, and deletion options (#52270) * Patterns: Update manage pattern links to go to site editor if available (#52403) * [Patterns] Separate sync status into a filter control (#52303) Co-authored-by: Saxon Fletcher <[email protected]> Co-authored-by: Glen Davies <[email protected]> * Patterns: Add missing decoding entities processing in Patterns and Template/Parts pages (#52449) * Fix document title icon appearance (#52424) * Quote block: Add transform to paragraph (#51809) * Add ungroup transform as transform to p * Lint * Update test and snapshot. --------- Co-authored-by: Juan Aldasoro <[email protected]> * remove sidebar group descriptions (#52453) * Patterns: alternative grid layout to improve keyboard accessibility (#52357) * add sync tooltip (#52458) * Patterns: Update section heading levels (#52273) * Ensure that the unsaved title is not persisted when reopening the modal (#52473) * Iframe: avoid asset parsing & fix script localisation (#52405) * Iframe: avoid asset parsing & fix script localisation * Add e2e test for script localisation * Update descriptions (#52468) * Footnotes: show in inserter and placehold (#52445) * Footnotes: show in inserter and placehold * Fix placeholder block membrane; fix copy; add icon, label --------- Co-authored-by: Miguel Fonseca <[email protected]> * Fix: Focus loss on navigation link label editing on Firefox. (#52428) * Update tooltip (#52465) * Refactor, document, and fix image block deprecations (#52081) * Refactor, document, and fix image block deprecations * Fix v5 attributes & supports * Fix v1 & v2 deprecation tests * Rename deprecated test descriptions * Respect custom aspect ratio (#52286) * add image width and height via css inline style, update width and height attrs to be string * keep width and height as attributes too, keep the attributes as numbers * updates image fixtures * RichText/Footnotes: make getRichTextValues work with InnerBlocks.Content (#52241) * RichText/Footnotes: make getRichTextValues work with InnerBlocks.Content --------- Co-authored-by: Miguel Fonseca <[email protected]> * Footnotes: save numbering through the entity provider (#52423) * Footnotes: save numbering through the entity provider * Add sup so no styling is needed at all * Migrate old format * Restore old styles, fix nested attribute queries * Fix anchor selection * Migrate markup in entity provider instead * Fix tests * Fix typo * Fix comment --------- Co-authored-by: Miguel Fonseca <[email protected]> * Revert "Post editor: Require confirmation before removing Footnotes (#52277)" (#52486) This reverts commit e6426ea. * List block: Fix selected type option (#52472) * Library - make pattern title clickable (#51898) * Use button inside title * Remove href * Preserve roving tab index * Fix link colors to match trunk $gray-600 * Remove redundant var * Amend colors as per review * remove old files again --------- Co-authored-by: scruffian <[email protected]> * remove status icon (#52457) * Rename block theme activation nonce variable. (#52398) --------- Co-authored-by: Bernie Reiter <[email protected]> Co-authored-by: Ella <[email protected]> Co-authored-by: Aki Hamano <[email protected]> Co-authored-by: Andrea Fercia <[email protected]> Co-authored-by: Carolina Nymark <[email protected]> Co-authored-by: George Mamadashvili <[email protected]> Co-authored-by: Andrei Draganescu <[email protected]> Co-authored-by: Aaron Robertshaw <[email protected]> Co-authored-by: Kai Hao <[email protected]> Co-authored-by: Saxon Fletcher <[email protected]> Co-authored-by: Glen Davies <[email protected]> Co-authored-by: James Koster <[email protected]> Co-authored-by: Rich Tabor <[email protected]> Co-authored-by: Juan Aldasoro <[email protected]> Co-authored-by: Miguel Fonseca <[email protected]> Co-authored-by: Jorge Costa <[email protected]> Co-authored-by: Alex Lende <[email protected]> Co-authored-by: Héctor <[email protected]> Co-authored-by: Petter Walbø Johnsgård <[email protected]> Co-authored-by: Dave Smith <[email protected]> Co-authored-by: scruffian <[email protected]> Co-authored-by: Peter Wilson <[email protected]>
@kevin940726, I noticed (while testing #53666) that the If the Patterns API doesn't support filtering, we should perform it outside the |
What and Why?
Part of #51948. Revamp the layout of the "My patterns" screen and refactor some code around it to better prepare for pagination in the future.
The goal is to limit the number of patterns rendered on screen so that users with many patterns (>100) won't get frozen or crash. This is a temporary solution until we decide which accessible pagination system to use.
How?
Worth noting that even though we only render at most 100 patterns at a time, we're still fetching all the patterns from the API. It's needed so that we can do client-side filtering and searching. In the future, we might decide to switch to server-side filtering and searching (#52396) once the API supports them.
Testing Instructions
Testing Instructions for Keyboard
Follow the same steps above. The grid list is using
<Composite>
so that it should be able to navigate through arrow buttons. It's likely not accessible enough though, but that can be tackled in another PR.Screenshots or screencast
Kapture.2023-07-07.at.15.46.28.mp4